package com.android.route;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.Projection;

public class DrawPath2Point extends Overlay {
    private GeoPoint startGeoPoint;
    private GeoPoint stopGeoPoint;
    private int color;
    public DrawPath2Point(GeoPoint start,GeoPoint stop,int color){
	this.startGeoPoint = start;
	this.stopGeoPoint = stop;
	this.color = color;
    }
    @Override
    public boolean draw(Canvas canvas, MapView mapView, boolean shadow,
	    long when) {
	// TODO Auto-generated method stub
	Projection projection = mapView.getProjection();
	if(shadow == false){
	    Paint paint = new Paint();
	    paint.setAntiAlias(true);
	    Point point = new Point();
	    projection.toPixels(startGeoPoint, point);
	    paint.setColor(color);
	    Point point2 = new Point();
	    projection.toPixels(stopGeoPoint, point2);
	    paint.setStrokeWidth(5);
	    canvas.drawLine((float)point.x, (float)point.y, (float)point2.x, (float)point2.y, paint);
	}
	return super.draw(canvas, mapView, shadow, when);
    }
    @Override
    public void draw(Canvas canvas, MapView mapView, boolean shadow) {
	// TODO Auto-generated method stub
	super.draw(canvas, mapView, shadow);
    }
    
    
    

}
